﻿using SqlSugar;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace LLog.Web.Common
{
    public static class Extensions
    {
        public static PageList<T> ToPage<T>(this ISugarQueryable<T> queryable, int pageIndex, int pageSize)
        {
            var count = 0;
            var pageList = new PageList<T>();
            pageList.Data = queryable.ToPageList(pageIndex, pageSize, ref count);
            pageList.Count = count;
            return pageList;
        }
    }
    public class PageList<T>
    {
        public List<T> Data { set; get; }
        public int Count { set; get; }

    }
}
